import request from './request'

// 获取指定ID的健康讲座
export const getHealthLectureApi = id => request.get(`/health-lectures/${id}`)

// 获取即将开始的讲座
export const getUpcomingLecturesApi = (limit = 5) => request.get('/health-lectures/upcoming', {
    params: { limit }
})

// 获取正在进行的讲座
export const getOngoingLecturesApi = () => request.get('/health-lectures/ongoing')

// 点赞健康讲座
export const likeHealthLectureApi = id => request.post(`/health-lectures/${id}/like`)

export const registerLectureApi = id => request.post(`/lecture-registrations/${id}`)

export const getLectureCategoriesApi = () => {
  return request({
    url: '/lecture/categories',
    method: 'GET'
  })
}

export const getLectureListApi = (params) => {
  return request({
    url: '/lecture/list',
    method: 'GET',
    params
  })
}

export const getLectureDetailApi = (id) => {
  return request({
    url: `/lecture/${id}`,
    method: 'GET'
  })
}

export const toggleCollectLectureApi = (id, isCollected) => {
  return request({
    url: `/lecture/collect/${id}`,
    method: 'POST',
    data: { isCollected }
  })
} 